#!/bin/sh
 
echo "Delete DarwinStreamingServer.pkg install"
echo "use 'delete' to delete files"
echo "use 'force' to force delete files"
echo "use 'list' to see the files to delete"

rm /tmp/cleandss

find /Library/Receipts/DarwinStreamingServer.pkg >> /tmp/cleandss
find /Library/QuickTimeStreaming >> /tmp/cleandss
find /usr/sbin/QuickTimeStreamingServer >> /tmp/cleandss
find /Library/QuickTimeStreaming >> /tmp/cleandss

find /usr/share/man/man1/PlaylistBroadcaster.1 >> /tmp/cleandss
find /usr/share/man/man1/MP3Broadcaster.1  >> /tmp/cleandss

find /usr/share/man/man8/QuickTimeStreamingServer.8  >> /tmp/cleandss
find /usr/share/man/man8/StreamingLoadTool.8  >> /tmp/cleandss


find /usr/bin/createuserstreamingdir >> /tmp/cleandss
find /usr/bin/MP3Broadcaster >> /tmp/cleandss
find /usr/bin/PlaylistBroadcaster >> /tmp/cleandss
find /usr/bin/MP3Broadcaster >> /tmp/cleandss
find /usr/bin/StreamingLoadTool  >> /tmp/cleandss
find /usr/bin/broadcasterctl >> /tmp/cleandss
find /usr/sbin/streamingadminserver.pl >> /tmp/cleandss
find /System/Library/StartupItems/QuickTimeStreamingServer >> /tmp/cleandss

echo "file count"
echo "----------"
cat /tmp/cleandss | wc -l 

if [ "$1" = "list" ] ; then
	echo
	echo "----------"
	echo "list"
	echo "----------"
	cat /tmp/cleandss
fi

CLEAN="NO"
if [ "$1" = "delete" ] ; then
	CLEAN="YES"
	OPTIONS="-rvi"
fi
if [ "$1" = "force" ] ; then
	CLEAN="YES"
	OPTIONS="-rvf"
fi

if [ "$CLEAN" = "YES" ] ; then
	
	echo ""
	echo " DELETETING FILES"
	echo ""

	rm $OPTIONS /Library/Receipts/DarwinStreamingServer.pkg
	rm $OPTIONS /Library/QuickTimeStreaming
	
	rm $OPTIONS /usr/bin/createuserstreamingdir
	rm $OPTIONS /usr/bin/MP3Broadcaster
	rm $OPTIONS /usr/bin/PlaylistBroadcaster
	rm $OPTIONS /usr/bin/broadcasterctl
	rm $OPTIONS /usr/sbin/QuickTimeStreamingServer
	rm $OPTIONS /usr/sbin/streamingadminserver.pl
	rm $OPTIONS /usr/bin/StreamingLoadTool
	rm $OPTIONS /System/Library/StartupItems/QuickTimeStreamingServer
	
	rm $OPTIONS /usr/share/man/man1/PlaylistBroadcaster.1
	rm $OPTIONS /usr/share/man/man1/MP3Broadcaster.1 

	rm $OPTIONS /usr/share/man/man8/QuickTimeStreamingServer.8 
	rm $OPTIONS /usr/share/man/man8/StreamingLoadTool.8 

fi

